package com.macro.mall.portal.controller;


import com.macro.mall.common.api.CommonResult;
import com.macro.mall.portal.domain.Credit;
import com.macro.mall.portal.domain.GuidancePrice;
import com.macro.mall.portal.service.ICreditService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.io.UnsupportedEncodingException;
import java.net.URLDecoder;
import java.util.List;
import java.util.Map;

/**
 * 征信查询表 前端控制器
 *
 * @since 2021-07-04
 */
@RestController
@RequestMapping("/credit")
@Api(tags = "CreditController", description = "征信查询")
public class CreditController {

    @Autowired
    private ICreditService iCreditService;

    @ApiOperation("查询征信查询记录")
    @RequestMapping(value = "/selectList", method = RequestMethod.POST)
    public CommonResult selectList(@RequestBody String sear) throws UnsupportedEncodingException {
        String name = URLDecoder.decode(sear, "UTF-8");
        String[] split = name.split("=");
        System.out.println(split[1]);
        List<Credit> guidancePriceList = null;
        try {
            guidancePriceList = iCreditService.selectList(split[1]);
//            guidancePriceList = iCreditService.selectList(sear.getArea());
        } catch (Exception e) {
            e.printStackTrace();
            return CommonResult.failed("服务器异常");
        }
        return CommonResult.success(guidancePriceList);
    }
}
